package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.service.store.awk.bean.AppZoneTraceInfoCardBean;
import o.azb;
import o.cgz;
import o.cke;
import o.csv;
import o.dof;
import o.ContentManager;
import o.ebz;
import o.epv;
import o.eqx;
import o.NetWorkUtil;
import o.ewm.j;
import o.ewm.n;

public class AppZoneTraceInfoCard extends BaseDistCard {
    private TextView ʻ;
    private TextView ʼ;
    private TextView ʽ;
    private ImageView ˋ;
    private ImageView ˋॱ;
    private View ॱˊ;
    private TextView ॱॱ;
    private LinearLayout ᐝ;

    public AppZoneTraceInfoCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (ImageView) view.findViewById(j.ʻˊ);
        ॱ((TextView) view.findViewById(j.ʽ));
        ˋ((DownloadButton) view.findViewById(j.ᵣ));
        ˏ((LinearLayout) view.findViewById(j.ꞌॱ));
        azb.ˏ(ˊ());
        ˏ((TextView) view.findViewById(j.ˌॱ));
        this.ॱॱ = (TextView) view.findViewById(j.ˋʽ);
        this.ʻ = (TextView) view.findViewById(j.ˋʻ);
        this.ʼ = (TextView) view.findViewById(j.ˋʼ);
        this.ॱˊ = view.findViewById(j.ᐧᐝ);
        azb.ʻ(this.ॱˊ);
        ((LayoutParams) this.ॱˊ.getLayoutParams()).setMarginStart(epv.ᐝ());
        this.ˋॱ = (ImageView) view.findViewById(j.ᐨʼ);
        ʽ(view);
        return this;
    }

    public LinearLayout ˊ() {
        return this.ᐝ;
    }

    private void ˏ(LinearLayout linearLayout) {
        this.ᐝ = linearLayout;
    }

    private void ˏ(TextView textView) {
        this.ʽ = textView;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        this.ॱˊ.setVisibility(ˊᐝ() ? 0 : 4);
        if (cardBean instanceof AppZoneTraceInfoCardBean) {
            AppZoneTraceInfoCardBean appZoneTraceInfoCardBean = (AppZoneTraceInfoCardBean) cardBean;
            if (appZoneTraceInfoCardBean.ॱˌ() != null) {
                eqx.ˏ(this.ˋ, appZoneTraceInfoCardBean.ॱˌ(), "app_default_icon");
            }
            if (appZoneTraceInfoCardBean.ˊ() == 1 && !dof.ॱ(appZoneTraceInfoCardBean.ˊˋ())) {
                if (!ebz.ॱ().ˎ(this.ˊᐝ.ॱـ())) {
                    ebz.ॱ().ˋ(this.ˊᐝ.ॱـ(), this.ˊᐝ.v_());
                    csv.ˋ().ˋ(this.ˊᐝ.ॱـ());
                }
                appZoneTraceInfoCardBean.ॱˊ("");
            }
            appZoneTraceInfoCardBean.ˏ("1");
            if (dof.ˋ(appZoneTraceInfoCardBean.ॱˋ())) {
                this.ʻ.setVisibility(8);
            } else {
                this.ʻ.setText(appZoneTraceInfoCardBean.ॱˋ());
                this.ʻ.setVisibility(0);
            }
            this.ॱॱ.setText(appZoneTraceInfoCardBean.ॱ());
            this.ʼ.setText(appZoneTraceInfoCardBean.ʽ());
            ॱ(appZoneTraceInfoCardBean);
        }
    }

    private void ॱ(AppZoneTraceInfoCardBean appZoneTraceInfoCardBean) {
        CharSequence ˏ;
        if (this.ˏ == cke.ˋॱ) {
            ˏ = ˏ(ContentManager.getInstant().getContext());
            if (!dof.ˋ(ˏ)) {
                this.ʽ.setText(ˏ);
                this.ˋॱ.setVisibility(8);
            }
        } else if (appZoneTraceInfoCardBean.ٴ() != 0) {
            String ՙ = appZoneTraceInfoCardBean.ՙ();
            if (dof.ˋ(ՙ)) {
                this.ˋॱ.setVisibility(8);
            } else {
                this.ˋॱ.setVisibility(0);
                eqx.ˎ(this.ˋॱ, ՙ);
            }
            ˏ = appZoneTraceInfoCardBean.ߴ();
            if (dof.ˋ(ˏ)) {
                this.ʽ.setText("");
            } else {
                this.ʽ.setText(ˏ);
            }
        } else if (!dof.ˋ(appZoneTraceInfoCardBean.O_())) {
            this.ʽ.setText(appZoneTraceInfoCardBean.O_());
            this.ˋॱ.setVisibility(8);
        }
    }

    private String ˏ(Context context) {
        return NetWorkUtil.getWifiResId(context, n.ʽﾞ);
    }
}
